<template>
  <div class="hot-list">
    <mini-table>
      <div slot="left">热门歌单</div>
      <div slot="right"></div>
      <div class="list-body" slot="body">
        <div class="box" v-for="(item, index) in hotFiveList" :key="index">
          <div class="left">
            <el-image
              :src="item.coverImgUrl"
              alt=""
              lazy
              @click="toPlayList(item)"
            />
          </div>
          <div class="right">
            <a href="javascript:;" class="a-top" @click="toPlayList(item)">{{
              item.name
            }}</a>
            <p>
              <span>by</span>
              <a href="javascript:;" class="a-bottom"
                >{{ item.creator.nickname }}
              </a>
              <img
                v-if="item.creator.avatarDetail"
                :src="item.creator.avatarDetail.identityIconUrl"
                alt=""
              />
            </p>
          </div>
        </div>
      </div>
    </mini-table>
  </div>
</template>

<script>
import MiniTable from "../../../components/common/mini-table.vue";

export default {
  components: {
    MiniTable,
  },
  props: {
    hotFiveList: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  methods: {
    toPlayList(item) {
      this.$router.push({
        path: `/playlist`,
        query: {
          id: item.id,
        },
      });
      // this.$router.go(0);
    },
  },
  // watch: {
  //   $route () {
  //     this.$router.go(0)
  //   }
  // },
};
</script>

<style lang="scss" scoped>
.hot-list {
  margin-top: 40px;
}
a:hover {
  text-decoration: underline;
}
.list-body {
  .box {
    margin-top: 20px;
    width: 200px;
    height: 50px;
    display: flex;
    .right {
      margin-left: 10px;
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      .a-top {
        display: block;
        width: 140px;
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        word-wrap: normal;
      }
      p {
        width: 140px;
        display: flex;
        align-items: center;
        color: #999;
        img {
          margin-left: 1px;
          display: block;
          width: 13px;
          height: 13px;
        }
      }
      .a-bottom {
        display: block;
        
        padding-left: 5px;
        color: #666;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        word-wrap: normal;
      }
    }
    .left {
      width: 50px;
      height: 50px;
      .el-image {
        display: block;
        width: 100%;
        height: 100%;
        &:hover {
          cursor: pointer;
        }
      }
    }
  }
}
</style>